{% extends "base.html" %}

{% block content %}
<h2>搜索问题工单</h2>

<table class="table table-striped">
    <thead>
        <tr>
            <th>工单ID</th>
            <th>搜索词</th>
            <th>问题类型</th>
            <th>状态</th>
            <th>提交时间</th>
        </tr>
    </thead>
    <tbody>
        {% for ticket in tickets %}
        <tr>
            <td>{{ ticket.ticket_id }}</td>
            <td>{{ ticket.query or 'N/A' }}</td>
            <td>
                {% if ticket.issue_type == 'no_results' %}无结果
                {% elif ticket.issue_type == 'irrelevant' %}不相关
                {% elif ticket.issue_type == 'sorting' %}排序问题
                {% else %}其他{% endif %}
            </td>
            <td>
                <span class="badge
                    {% if ticket.status == 'open' %}bg-warning
                    {% elif ticket.status == 'in_progress' %}bg-info
                    {% elif ticket.status == 'resolved' %}bg-success
                    {% else %}bg-secondary{% endif %}">
                    {{ ticket.status }}
                </span>
            </td>
            <td>{{ ticket.created_at.strftime('%Y-%m-%d %H:%M') }}</td>
        </tr>
        {% endfor %}
    </tbody>
</table>
{% endblock %}